#ifndef CAMPAIGNFORM_H
#define CAMPAIGNFORM_H

#include <dtwentymodel.h>
#include <characterclasstablemodel.h>

#include <QWidget>
#include <QFileInfo>
#include <QSortFilterProxyModel>


namespace Ui {
class CampaignForm;
}

class CampaignForm : public QWidget
{
    Q_OBJECT
    
public:

    explicit CampaignForm(QWidget *parent = 0);
    ~CampaignForm();

    void create();
    bool open(const QString& fileName = QString());
    bool save(const QString& fileName = QString());

    QFileInfo fileInfo() const;
    QList<QAction*> campaignActions();
    QMap<QString, QAction*> characterClassActions();

signals:

    void sigActionsChanged();


protected slots:

    void onRefreshActions();
    void onModelActionTriggered();
    void onSelectionChanged();
    void onLayoutChanged();


protected:

    QModelIndex sourceIndex(const QModelIndex& index) const;


private slots:

    void on_actionDelete_triggered();


    void on_comboBox_currentIndexChanged(int index);

private:

    Ui::CampaignForm *ui;

    DTwentyModel* m_dtwentyModel;
    QSortFilterProxyModel* m_sortModel;

    CharacterClassTableModel* m_ccModel;


//    QList<QAction*> m_persistentActions;
    QList<QAction*> m_campaignActions;
    QMap<QString, QAction*> m_characterClassActions;


    QString m_fileName;

};


#endif // CAMPAIGNFORM_H
